{% extends "base.html" %}

{% block content %}

		<div id="tagline">Your control panel, {{ user }}.{% if error %}<br/><small class="error">{{ error }}</small>{% endif %}</div>

		<div id="content_left">
			<div id="note"></div>
			<div id="fields">
				<form method="get" action="/create_website">
					<input class="textbox" type="text" name="domain" value="Domain" onfocus="if(this.value=='Domain')this.value=''" onblur="if(this.value=='')this.value='Domain'" />
					<input class="button" type="submit" name="submit" value="Add Website" />
				</form>
			</div>
			
			{% if view_site %}
				<h2>Viewing InfoRecords for: {{ view_site }}</h2>
				<h3><a href="/toggle_active/{{ website.key }}">Toggle {{ view_site }}, currently {% if website.active %}Enabled{% else %}Disabled{% endif %}</a></h3>

				{% if inforecords %}
				<table width="100%"><thead><tr><th>Identifier</th><th>Storage</th><td></td></tr></thead><tbody>
					{% for inforecord in inforecords %}
					<tr>
						<td>{{ inforecord.identifier }}</td>
						<td>{{ inforecord.storage }}</td>
						<td><a href="/delete/{{ inforecord.key }}">Delete</a></td>
					</tr>
					{% endfor %}
				</tbody></table>
				{% else %}
				<p>No inforecords exist for this website.</p>
				{% endif %}
			{% else %}
			
			<h2>How to use Killswitch.me</h2>
			<p>KillSwitch protects you, the Developer, by making it so critical information used by your Client's Application is stored off of your Client's server. We host <a href="http://www.killswitch.me/">Killswitch.me</a> on <a href="http://code.google.com/appengine">Google App Engine</a> to ensure we have the best uptime and response times possible.</p>
			
			<p>Here are some suggested possible things to store on Killswitch:</p>
			<ul>
				<li>User Passwords</li>
			</ul><br/><br/>
			
			<h2>The API</h2>
			<p>Below is a list of all API Calls that you can call and the params you can send (POST or GET). Call calls will output a '1' if successful, and a '0' if not on the first line, if there was an error it will print the error on the second line of the response. All calls must pass the <em>apikey</em> and the <em>secret</em>. Param names are must be lowercase.</p>
			
			<h3>http://www.killswitch.me/api/add<br/><small>Create a new InfoRecord.</small></h3>
			<ul><li>identifier (string)</li><li>storage (string, recommend you sha1 encrypt it before sending it to us)</li></ul>
			
			<h3>http://www.killswitch.me/api/rename<br/><small>Check the <em>Identifier</em> of an InfoRecord.</small></h3>
			<ul><li>identifier (string)</li><li>new_identifier (string)</li></ul>
			
			<h3>http://www.killswitch.me/api/update<br/><small>Update the <em>Storage</em> of an InfoRecord.</small></h3>
			<ul><li>identifier (string)</li><li>storage (string, recommend you sha1 encrypt it before sending it to us)</li></ul>

			<h3>http://www.killswitch.me/api/delete<br/><small>Delete an InfoRecord.</small></h3>
			<ul><li>identifier (string)</li></ul>
			
			<h3>http://www.killswitch.me/api/check<br/><small>Check to see if the <em>Storage</em> param matches that of the stored InfoRecord.</small></h3>
			<ul><li>identifier (string)</li><li>storage (string, recommend you sha1 encrypt it before sending it to us)</li></ul>
			
			<h2>Secure API</h2>
			<p>If you want to use SSL for the API just replace "<strong><pcdata>http://www.killswitch.me</pcdata></strong>" with "<strong><pcdata>https://killswitch-me.appspot.com</pcdata></strong>"</p>
			{% endif %}
		</div>

		<div id="content_right">
		{% if websites %}
			<h2>Your Websites</h2>
			<ul>
			{% for website in websites %}
				<li><a href="/view_site/{{ website.key }}"><strong>{{ website.domain }}</strong></a><pre><code>apikey: <pcdata>{{ website.apikey }}</pcdata>
secret: <pcdata>{{ website.secret }}</pcdata></code></pre></li>
			{% endfor %}
			</ul>
			{% endif %}
		</div>

{% endblock %}
